package com.summer.applet.entity;

import java.awt.Graphics;
import java.awt.Point;
import java.util.Random;

import com.summer.applet.entity.GameDirector.Node;


public class Flower implements Node{

	private Point location = new Point();
	private int size = 10;
	private int screenW=720,screenH=1024;
	
	private Flower() {
	}
	
	public static Flower create(int screenW,int screenH) {
		Flower flower = new Flower();
		flower.screenW = screenW;
		flower.screenH = screenH;
		flower.rebirth();
		return flower;
	}
	
	public void rebirth() {
		int min = 0;
        int maxScreenW = screenW/size;
        int maxscreenH = screenH/size;
        int w = new Random().nextInt(maxScreenW-min)+min;
        int h = new Random().nextInt(maxscreenH-min)+min;
        location.x = w * size;
        location.y = h * size;
	}
	
	public Point getLocation() {
		return location;
	}
	
	public void draw(Graphics graphics) {	
		graphics.drawRect(location.x, location.y, size, size);
	}
}
